package com.pes.arcww.service;

import java.util.Collection;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.pes.arcww.dao.QuestionsDAO;
import com.pes.arcww.form.Items;
import com.pes.arcww.form.Questions;
import com.pes.arcww.form.Topics;

@Service("questionService")
public class QuestionsServiceImpl implements QuestionsService{

	@Autowired
	private QuestionsDAO questionDAO;
	
	@Transactional
	public void addQuestion(Questions question) {
		questionDAO.addQuestion(question);
	}
	
	@Transactional
	public void addItem(Integer que_id, Items item) {
		questionDAO.addItem(que_id, item);
	}

	@Transactional
	public void addTopic(Integer que_id, Topics topic) {
		questionDAO.addTopic(que_id, topic);
	}

	@Transactional
	public Collection<Questions> listQuestions(String filter, String value) {
		return questionDAO.listQuestions(filter, value);
	}
	
	@Transactional
	public Collection<Questions> listQuestionsByProfiles(String where,
			Integer level) {
		// TODO Auto-generated method stub
		return questionDAO.listQuestionsByProfiles(where, level);
	}

	@Transactional
	public List<Items> listItems(Integer id) {
		return questionDAO.listItems(id);
	}

	@Transactional
	public void removeQuestion(Integer id) {
		questionDAO.removeQuestion(id);
	}

	@Transactional
	public void removeItem(Integer que_id, Integer ite_id) {
		questionDAO.removeItem(que_id, ite_id);
	}

	@Transactional
	public void updateQuestion(Questions question) {
		questionDAO.updateQuestion(question);
	}
	
	@Transactional
	public void updateItem(Integer que_id, Items item) {
		questionDAO.updateItem(que_id, item);
	}

	@Transactional
	public Questions getQuestion(Integer id) {
		return questionDAO.getQuestion(id);
	}
	
	@Transactional
	public Items getItem(Integer id) {
		// TODO Auto-generated method stub
		return questionDAO.getItem(id);
	}

	@Transactional
	public void removeItem(Integer ite_id) {
		questionDAO.removeItem(ite_id);
	}
}
